package com.itheima.web.controller;

import com.itheima.pojo.Assignment;
import com.itheima.pojo.StatisticsDto;
import com.itheima.pojo.WorkDto;
import com.itheima.service.UserStudentAssignmentService;
import com.itheima.utils.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("v1/work")
public class WorkContoller {
    @Autowired
    private UserStudentAssignmentService userStudentAssignmentService;
    @PostMapping("/publishWork")
    public ResponseResult insertWork(@RequestBody Assignment assignment){
       return userStudentAssignmentService.insert(assignment);
    }
    @PostMapping("/showWorks")
    public ResponseResult findAllWork(HttpServletRequest request, @RequestBody WorkDto workDto){
      return   userStudentAssignmentService.findWork(request,workDto);
    }
    @PostMapping("/findNotWorkByTime")
    public ResponseResult findNotWork(@RequestBody StatisticsDto statisticsDto){
        return userStudentAssignmentService.findNotWork(statisticsDto);
    }

}